const triggerTempArr = [
  {
    type: 'Stream',
    flowSetting: {
      'html': `
        <div class="indicator invisible"></div>
        <div data-v-0e6ea0e1="" data-v-27c47c42="" blockinfo='495710C3-930F-46C4-9D6B-2D7BC839FCCC'
          paramsvaluesend="{&quot;DataNode&quot;:true,&quot;type&quot;:&quot;&quot;}" class="hover-card block"
          style="background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 55px;"
          trackid="3a9b69fc-1613-4f2f-80a4-69f366f2b1f2">
          <div data-v-0e6ea0e1="" class="flowy-card">
            <div data-v-0e6ea0e1="" class="flowy-card-icon">
              <div data-v-0e6ea0e1="" class="el-image flowy-card-icon-image"><img
                  src="${window.SITE_CONFIG['ossAddressURL']}/app/bot/script/script_icon_general.png" draggable="false"
                  class="el-image__inner" style="object-fit: fill;">
                <!---->
              </div>
            </div>
            <div data-v-0e6ea0e1="" class="flowy-card-item">
              <div data-v-0e6ea0e1="" class="title"><span data-v-0e6ea0e1="" class="el-tooltip"
                  aria-describedby="el-tooltip-` + uuid(4, 10) + `" tabindex="0">739a24b2-3b84-11eb-adc1-0242ac120002</span>
                <div class="more_operation">
                  <div class="el-icon-more"></div>
                  <div class="drop_down_block">
                    <div class="edit_operation">
                      <div class="cuifont icon_edit"></div>
                      <div>Edit</div>
                    </div>
                  </div>
                </div>
              </div>
              <div data-v-0e6ea0e1="" class="tips">
                <div data-v-0e6ea0e1="" class="tips-area">This node is used for 739a24b2-3b84-11eb-adc1-0242ac120002
                  acquisition.</div>
              </div>
              <div data-v-0e6ea0e1="" class="description">
                <div data-v-0e6ea0e1="" class="content-area">9120565a-3b84-11eb-adc1-0242ac120002</div>
                <div class="edit_icon_desc">
                  <span class="cuifont icon_edit"></span>
                </div>
                <div class="input_desc"><input type="text"></div>
              </div>
            </div>
          </div>
          <div data-v-170cdace="" data-v-0e6ea0e1="" class="el-dialog__wrapper" blockinfo="[object Object]"
            style="display: none;">
            <div role="dialog" aria-modal="true" aria-label="dialog" class="el-dialog"
              style="margin-top: 15vh; width: 69rem;">
              <div class="el-dialog__header">
                <div data-v-170cdace="">
                  <div data-v-170cdace="" class="title">\n \n
                    <!---->
                    <!---->
                    <!---->
                  </div>
                </div><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i
                    class="el-dialog__close el-icon el-icon-close"></i></button>
              </div>
              <!---->
              <div class="el-dialog__footer"><span data-v-170cdace="" class="dialog-footer"><button data-v-170cdace=""
                    type="button" class="el-button el-button--default el-button--mini">
                    <!---->
                    <!----><span>Cancel</span></button><button data-v-170cdace="" type="button"
                    class="el-button el-button--primary el-button--mini">
                    <!---->
                    <!----><span>Confirm</span></button></span></div>
            </div>
          </div><input type="hidden" name="blockid" class="blockid" value="0">
        </div>
      `,
      'blockarr': [
        {
          'childwidth': 0,
          'parent': -1,
          'id': 0,
          'x': 755,
          'y': 268,
          'width': 280,
          'height': 100
        }
      ],
      'blocks': [
        {
          'id': 0,
          'parent': -1,
          'data': [
            {
              'name': 'blockid',
              'value': '0'
            }
          ],
          'attr': [
            {
              'data-v-0e6ea0e1': ''
            },
            {
              'data-v-27c47c42': ''
            },
            {
              'blockinfo': '{"id":"1328588261015261185","tenantCode":null,"botId":null,"name":"739a24b2-3b84-11eb-adc1-0242ac120002","context":null,"scope":"System","triggerEvent":"Stream","createTime":"2020-11-17T06:38:20Z","enable":null,"language":null,"paramsValue":null,"paramsJson":{"fields":[{"text":"DataNode","type":"form-hidden","defaultValue":true},{"hint":"","text":"type","type":"customized-select","label":"Data Source","selectList":[{"lable":"CW-Ticket","value":"ConnectWise-Ticket"},{"lable":"CW-Timeentry","value":"ConnectWise-Timeentry"},{"lable":"AT-Timeentry","value":"AutoTask-Ticket"},{"lable":"AT-Timeentry","value":"AutoTask-Timeentry"}],"defaultValue":""}]},"version":"","applyTenant":null,"author":"Dennis Zhang","updateTime":"2020-12-07T06:47:12Z","description":"9120565a-3b84-11eb-adc1-0242ac120002","disable":null,"newFlag":null,"type":"trigger","icon":null,"trackId":null}'
            },
            {
              'paramsvaluesend': '{ "DataNode": "true", "type": "" }'
            },
            {
              'class': 'hover-card block'
            },
            {
              'style': 'background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 55px;'
            },
            {
              'trackid': ''
            }
          ]
        }
      ]
    }
  },
  {
    type: 'TeamsCommand',
    flowSetting: {
      'html': `<div class="indicator invisible"></div>
        <div data-v-0e6ea0e1="" data-v-27c47c42="" blockinfo='495710C3-930F-46C4-9D6B-2D7BC839FCCC'
          paramsvaluesend="{&quot;command&quot;:&quot;&quot;}" class="hover-card block"
          style="background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 54px;"
          trackid="3a9b69fc-1613-4f2f-80a4-69f366f2b1f2">
          <div data-v-0e6ea0e1="" class="flowy-card">
            <div data-v-0e6ea0e1="" class="flowy-card-icon">
              <div data-v-0e6ea0e1="" class="el-image flowy-card-icon-image"><img
                  src="${window.SITE_CONFIG['ossAddressURL']}/app/bot/script/script_icon_general.png" draggable="false"
                  class="el-image__inner" style="object-fit: fill;">
                <!---->
              </div>
            </div>
            <div data-v-0e6ea0e1="" class="flowy-card-item">
              <div data-v-0e6ea0e1="" class="title"><span data-v-0e6ea0e1="" class="el-tooltip"
                  aria-describedby="el-tooltip-` + uuid(4, 10) + `" tabindex="0">739a24b2-3b84-11eb-adc1-0242ac120002</span>
                  <div class="more_operation">
                    <div class="el-icon-more"></div>
                    <div class="drop_down_block">
                      <div class="edit_operation">
                        <div class="cuifont icon_edit"></div>
                        <div>Edit</div>
                      </div>
                    </div>
                  </div>
              </div>
              <div data-v-0e6ea0e1="" class="tips">
                <div data-v-0e6ea0e1="" class="tips-area">Recognising 739a24b2-3b84-11eb-adc1-0242ac120002</div>
              </div>
              <!-- <div data-v-0e6ea0e1="" class="description">
                <div data-v-0e6ea0e1="" class="content-area">Recognising Teams command</div>
              </div> -->
              
              <div data-v-0e6ea0e1="" class="description">
                <div data-v-0e6ea0e1="" class="content-area">9120565a-3b84-11eb-adc1-0242ac120002</div>
                <div class="edit_icon_desc">
                  <span class="cuifont icon_edit"></span>
                </div>
                <div class="input_desc"><input type="text"></div>
              </div>
      
            </div>
          </div>
          <div data-v-170cdace="" data-v-0e6ea0e1="" class="el-dialog__wrapper" blockinfo="[object Object]"
            style="display: none;">
            <div role="dialog" aria-modal="true" aria-label="dialog" class="el-dialog"
              style="margin-top: 15vh; width: 69rem;">
              <div class="el-dialog__header">
                <div data-v-170cdace="">
                  <div data-v-170cdace="" class="title">\n \n
                    <!---->
                    <!---->
                    <!---->
                  </div>
                </div><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i
                    class="el-dialog__close el-icon el-icon-close"></i></button>
              </div>
              <!---->
              <div class="el-dialog__footer"><span data-v-170cdace="" class="dialog-footer"><button data-v-170cdace=""
                    type="button" class="el-button el-button--default el-button--mini">
                    <!---->
                    <!----><span>Cancel</span></button><button data-v-170cdace="" type="button"
                    class="el-button el-button--primary el-button--mini">
                    <!---->
                    <!----><span>Confirm</span></button></span></div>
            </div>
          </div><input type="hidden" name="blockid" class="blockid" value="0">
        </div>`,
      'blockarr': [
        {
          'parent': -1,
          'childwidth': 0,
          'id': 0,
          'x': 755,
          'y': 267,
          'width': 280,
          'height': 100
        }
      ],
      'blocks': [
        {
          'id': 0,
          'parent': -1,
          'data': [
            {
              'name': 'blockid',
              'value': '0'
            }
          ],
          'attr': [
            {
              'data-v-0e6ea0e1': ''
            },
            {
              'data-v-27c47c42': ''
            },
            {
              'blockinfo': '{"id":"1329366817186324482","tenantCode":null,"botId":null,"name":"739a24b2-3b84-11eb-adc1-0242ac120002","context":null,"scope":"System","triggerEvent":"TeamsCommand","createTime":"2020-11-19T07:29:11Z","enable":null,"language":null,"paramsValue":null,"paramsJson":{"fields":[{"hint":"","text":"command","type":"text","label":"command","defaultValue":""}]},"version":"","applyTenant":null,"author":null,"updateTime":null,"description":"9120565a-3b84-11eb-adc1-0242ac120002","disable":null,"newFlag":null,"type":"trigger","icon":null,"trackId":null}'
            },
            {
              'paramsvaluesend': '{"command":""}'
            },
            {
              'class': 'hover-card block'
            },
            {
              'style': 'background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 54px;'
            },
            {
              'trackid': ''
            }
          ]
        }
      ]
    }
  },
  {
    type: 'Timed',
    flowSetting: {
      'html': `<div class="indicator invisible"></div>
        <div data-v-0e6ea0e1="" data-v-27c47c42="" blockinfo='495710C3-930F-46C4-9D6B-2D7BC839FCCC'
          paramsvaluesend="{&quot;schedule&quot;:&quot;&quot;}" class="hover-card block"
          style="background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 54px;"
          trackid="3a9b69fc-1613-4f2f-80a4-69f366f2b1f2">
          <div data-v-0e6ea0e1="" class="flowy-card">
            <div data-v-0e6ea0e1="" class="flowy-card-icon">
              <div data-v-0e6ea0e1="" class="el-image flowy-card-icon-image"><img
                  src="${window.SITE_CONFIG['ossAddressURL']}/app/bot/script/script_icon_general.png" draggable="false"
                  class="el-image__inner" style="object-fit: fill;">
                <!---->
              </div>
            </div>
            <div data-v-0e6ea0e1="" class="flowy-card-item">
              <div data-v-0e6ea0e1="" class="title"><span data-v-0e6ea0e1="" class="el-tooltip"
                  aria-describedby="el-tooltip-` + uuid(4, 10) + `" tabindex="0">739a24b2-3b84-11eb-adc1-0242ac120002</span>
                <div class="more_operation">
                  <div class="el-icon-more"></div>
                  <div class="drop_down_block">
                    <div class="edit_operation">
                      <div class="cuifont icon_edit"></div>
                      <div>Edit</div>
                    </div>
                  </div>
                </div>
              </div>
              <div data-v-0e6ea0e1="" class="tips">
                <div data-v-0e6ea0e1="" class="tips-area">This node is used for timed-task trigger.</div>
              </div>
              <div data-v-0e6ea0e1="" class="description">
                <div data-v-0e6ea0e1="" class="content-area">9120565a-3b84-11eb-adc1-0242ac120002</div>
                <div class="edit_icon_desc">
                  <span class="cuifont icon_edit"></span>
                </div>
                <div class="input_desc"><input type="text"></div>
              </div>
      
            </div>
          </div>
          <div data-v-170cdace="" data-v-0e6ea0e1="" class="el-dialog__wrapper" blockinfo="[object Object]"
            style="display: none;">
            <div role="dialog" aria-modal="true" aria-label="dialog" class="el-dialog"
              style="margin-top: 15vh; width: 69rem;">
              <div class="el-dialog__header">
                <div data-v-170cdace="">
                  <div data-v-170cdace="" class="title">\n \n
                    <!---->
                    <!---->
                    <!---->
                  </div>
                </div><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i
                    class="el-dialog__close el-icon el-icon-close"></i></button>
              </div>
              <!---->
              <div class="el-dialog__footer"><span data-v-170cdace="" class="dialog-footer"><button data-v-170cdace=""
                    type="button" class="el-button el-button--default el-button--mini">
                    <!---->
                    <!----><span>Cancel</span></button><button data-v-170cdace="" type="button"
                    class="el-button el-button--primary el-button--mini">
                    <!---->
                    <!----><span>Confirm</span></button></span></div>
            </div>
          </div><input type="hidden" name="blockid" class="blockid" value="0">
        </div>`,
      'blockarr': [
        {
          'parent': -1,
          'childwidth': 0,
          'id': 0,
          'x': 755,
          'y': 267,
          'width': 280,
          'height': 100
        }
      ],
      'blocks': [
        {
          'id': 0,
          'parent': -1,
          'data': [
            {
              'name': 'blockid',
              'value': '0'
            }
          ],
          'attr': [
            {
              'data-v-0e6ea0e1': ''
            },
            {
              'data-v-27c47c42': ''
            },
            {
              'blockinfo': '{"id":"1328588261015261186","tenantCode":null,"botId":null,"name":"739a24b2-3b84-11eb-adc1-0242ac120002","context":null,"scope":"System","triggerEvent":"Timed","createTime":"2020-11-17T06:38:20Z","enable":null,"language":null,"paramsValue":null,"paramsJson":{"fields":[{"hint":"Schedule","text":"schedule","type":"schedule","label":"Schedule","showData":"showData","defaultValue":""}]},"version":"","applyTenant":null,"author":"Dennis Zhang","updateTime":null,"description":"9120565a-3b84-11eb-adc1-0242ac120002","disable":null,"newFlag":null,"type":"trigger","icon":null,"trackId":null}'
            },
            {
              'paramsvaluesend': '{"schedule":""}'
            },
            {
              'class': 'hover-card block'
            },
            {
              'style': 'background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 54px;'
            },
            {
              'trackid': ''
            }
          ]
        }
      ]
    }
  },
  {
    type: 'Timed',
    'flowSetting': {
      'html': `<div class="indicator invisible"></div>
      <div data-v-0e6ea0e1="" data-v-27c47c42="" blockinfo='495710C3-930F-46C4-9D6B-2D7BC839FCCC'
        paramsvaluesend="{&quot;frequency&quot;:{&quot;dates&quot;:&quot;&quot;,&quot;times&quot;:&quot;&quot;,&quot;number&quot;:&quot;&quot;,&quot;cornstr&quot;:&quot;&quot;,&quot;dateValue&quot;:&quot;4&quot;}}"
        class="hover-card block"
        style="background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 67px;"
        trackid="3a9b69fc-1613-4f2f-80a4-69f366f2b1f2">
        <div data-v-0e6ea0e1="" class="flowy-card">
          <div data-v-0e6ea0e1="" class="flowy-card-icon">
            <div data-v-0e6ea0e1="" class="el-image flowy-card-icon-image"><img
                src="${window.SITE_CONFIG['ossAddressURL']}/app/bot/script/script_icon_general.png" draggable="false"
                class="el-image__inner" style="object-fit: fill;">
              <!---->
            </div>
          </div>
          <div data-v-0e6ea0e1="" class="flowy-card-item">
            <div class="title">
                <span class="el-tooltip"  placement="top" data-v-0e6ea0e1="" aria-describedby="el-tooltip-` + uuid(4, 10) + `" tabindex="0" style="display:inline-block;width: 140px;overflow:hidden;text-overflow: ellipsis;"> 739a24b2-3b84-11eb-adc1-0242ac120002</span>

              <div class="more_operation">
                <div class="el-icon-more"></div>
                <div class="drop_down_block">
                  <div class="edit_operation">
                    <div class="cuifont icon_edit"></div>
                    <div>Edit</div>
                  </div>
                </div>
              </div>
            </div>
            <div data-v-0e6ea0e1="" class="tips">
              <div data-v-0e6ea0e1="" class="tips-area">9120565a-3b84-11eb-adc1-0242ac120002</div>
            </div>
            <div data-v-0e6ea0e1="" class="description">
              <div data-v-0e6ea0e1="" class="content-area">9120565a-3b84-11eb-adc1-0242ac120002</div>
              <div class="edit_icon_desc">
                <span class="cuifont icon_edit"></span>
              </div>
              <div class="input_desc"><input type="text"></div>
            </div>

          </div>
        </div>
        <div data-v-170cdace="" data-v-0e6ea0e1="" class="el-dialog__wrapper" blockinfo="[object Object]"
          style="display: none;">
          <div role="dialog" aria-modal="true" aria-label="dialog" class="el-dialog"
            style="margin-top: 15vh; width: 79rem;">
            <div class="el-dialog__header">
              <div data-v-170cdace="">
                <div data-v-170cdace="" class="title">\n \n
                  <!---->
                  <!---->
                  <!---->
                </div>
              </div><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i
                  class="el-dialog__close el-icon el-icon-close"></i></button>
            </div>
            <!---->
            <div class="el-dialog__footer"><span data-v-170cdace="" class="dialog-footer"><button data-v-170cdace=""
                  type="button" class="el-button el-button--default el-button--mini">
                  <!---->
                  <!----><span>Cancel</span></button><button data-v-170cdace="" type="button"
                  class="el-button el-button--primary el-button--mini">
                  <!---->
                  <!----><span>Confirm</span></button></span></div>
          </div>
        </div><input type="hidden" name="blockid" class="blockid" value="0">\
      </div>`,
      'blockarr': [
        {
          'parent': -1,
          'childwidth': 0,
          'id': 0,
          'x': 755,
          'y': 280,
          'width': 280,
          'height': 100
        }
      ],
      'blocks': [
        {
          'id': 0,
          'parent': -1,
          'data': [
            {
              'name': 'blockid',
              'value': '0'
            }
          ],
          'attr': [
            {
              'data-v-0e6ea0e1': ''
            },
            {
              'data-v-27c47c42': ''
            },
            {
              'blockinfo': '{"id":"1336977431127494658","tenantCode":null,"botId":null,"name":"739a24b2-3b84-11eb-adc1-0242ac120002","context":null,"scope":"","triggerEvent":"Timed","createTime":"2020-12-10T10:13:54Z","enable":null,"language":null,"paramsValue":null,"paramsJson":{"fields":[{"hint":"frequency","text":"frequency","type":"frequency","dates":"dates","label":"frequency","times":"times","number":"number","cornstr":"cornstr","dateValue":"dateValue","defaultValue":{"dates":"","times":"","number":"","cornstr":"","dateValue":"4"}}]},"version":"","applyTenant":null,"author":null,"updateTime":"2020-12-11T03:46:33Z","description":"9120565a-3b84-11eb-adc1-0242ac120002","disable":null,"newFlag":null,"type":"trigger","icon":null,"trackId":null}'
            },
            {
              'paramsvaluesend': '{"frequency":{"dates":"","times":"","number":"","cornstr":"","dateValue":"4"}}'
            },
            {
              'class': 'hover-card block'
            },
            {
              'style': 'background: #ffffff; border: 1px solid #efefef; border-radius: 6px; width: 280px; height: 100px; z-index: 1;  left: 20px; top: 67px;'
            },
            {
              'trackid': ''
            }
          ]
        }
      ]
    }
  }
]

function uuid (len, radix) {
  var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
  // eslint-disable-next-line one-var
  var uuid = [], i
  radix = radix || chars.length
  if (len) {
    for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
  } else {
    var r
    uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'

    uuid[14] = '4'
    for (i = 0; i < 36; i++) {
      if (!uuid[i]) {
        r = 0 | Math.random() * 16

        uuid[i] = chars[(i === 19) ? (r & 0x3) | 0x8 : r]
      }
    }
  }
  return uuid.join('')
}
// name 739a24b2-3b84-11eb-adc1-0242ac120002
// description  9120565a-3b84-11eb-adc1-0242ac120002
export default function (triggerType, block) {
  let trackid = uuid()
  let triggerObject = {}
  triggerTempArr.find(item => {
    if (item.type === triggerType) {
      triggerObject = item
      triggerObject.flowSetting.html = triggerObject.flowSetting.html.replaceAll('739a24b2-3b84-11eb-adc1-0242ac120002', block.name ? block.name : '')
      triggerObject.flowSetting.html = triggerObject.flowSetting.html.replaceAll('9120565a-3b84-11eb-adc1-0242ac120002', block.description ? block.description : '')
      triggerObject.flowSetting.html = triggerObject.flowSetting.html.replace('3a9b69fc-1613-4f2f-80a4-69f366f2b1f2', trackid)
      triggerObject.flowSetting.html = triggerObject.flowSetting.html.replace('495710C3-930F-46C4-9D6B-2D7BC839FCCC', JSON.stringify(block).replaceAll('\'', '\\"'))
      triggerObject.flowSetting.blocks[0].attr[2].blockinfo = JSON.stringify(block)
      triggerObject['paramsvaluesend'] = JSON.parse(item.flowSetting.blocks[0].attr[3].paramsvaluesend)
      triggerObject.flowSetting.blocks[0].attr[6].trackid = trackid
    }
  })
  triggerObject['trackid'] = trackid
  return triggerObject
}
